package com.kingdee.eas.custom.hr.assessment.base.app;

import org.apache.log4j.Logger;
import javax.ejb.*;
import java.rmi.RemoteException;
import java.util.HashSet;
import java.util.Iterator;

import com.kingdee.bos.*;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.bos.metadata.IMetaDataPK;
import com.kingdee.bos.metadata.rule.RuleExecutor;
import com.kingdee.bos.metadata.MetaDataPK;
//import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.framework.ejb.AbstractEntityControllerBean;
import com.kingdee.bos.framework.ejb.AbstractBizControllerBean;
//import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.service.ServiceContext;
import com.kingdee.bos.service.IServiceContext;

import java.lang.String;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.eas.custom.hr.assessment.base.AssessmentTimeConfigCollection;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.bos.metadata.entity.SorterItemCollection;
import com.kingdee.eas.framework.CoreBaseCollection;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.eas.custom.hr.assessment.base.AssessmentTimeConfigInfo;
import com.kingdee.eas.custom.hr.attendance.AttendanceTimeConfigInfo;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.eas.framework.ObjectBaseCollection;
import com.kingdee.eas.framework.app.DataBaseControllerBean;
import com.kingdee.eas.framework.DataBaseCollection;

public class AssessmentTimeConfigControllerBean extends AbstractAssessmentTimeConfigControllerBean
{
    private static Logger logger =
        Logger.getLogger("com.kingdee.eas.custom.hr.assessment.base.app.AssessmentTimeConfigControllerBean");
    

	
	protected IObjectPK _addnew(Context ctx, IObjectValue model)
		throws BOSException, EASBizException {
	
		AssessmentTimeConfigInfo info = (AssessmentTimeConfigInfo) model;
	HashSet addNewSet = new HashSet();
	addNewSet = (HashSet) info.get("newCmpPeriodInfo");
	Iterator addNewIterator = addNewSet.iterator();
	IObjectPK pkLastAddNew = null;
	while (addNewIterator.hasNext()) {
		AssessmentTimeConfigInfo infoTemp = (AssessmentTimeConfigInfo) addNewIterator
				.next();
	//	infoTemp
	//			.setPeriod(this.getCmpPeriodInfo(ctx, infoTemp.getNumber()));
		pkLastAddNew = super._addnew(ctx, infoTemp);
	}
	
	return pkLastAddNew;
	}
	
	
	
	protected void _update(Context ctx, IObjectPK pk, IObjectValue model)
		throws BOSException, EASBizException {
		AssessmentTimeConfigInfo info = (AssessmentTimeConfigInfo) model;
	HashSet updateSet = new HashSet();
	
	updateSet = (HashSet) info.get("modifyCmpPeriodInfo");
	Iterator updateIterator = updateSet.iterator();
	IObjectPK pkUpdate = null;
	while (updateIterator.hasNext()) {
		AssessmentTimeConfigInfo infoTemp = (AssessmentTimeConfigInfo) updateIterator
				.next();
		pkUpdate = new ObjectUuidPK(infoTemp.getId());
		super._update(ctx, pkUpdate, infoTemp);
	}
	}
    
}